package cn.topevery.garden.dal.dao.impl;

import cn.topevery.garden.dal.dao.CriterionExpandShowDao;
import cn.topevery.garden.entity.po.CriterionExpandShow;
import cn.topevery.garden.entity.query.CriterionExpandShowQuery;
import cn.topevery.garden.entity.vo.CriterionExpandShowVO;
import cn.topevery.garden.framework.base.BaseDaoImpl;
import hw.topevery.framework.db.entity.DataPager;
import hw.topevery.framework.db.entity.SqlQueryMate;
import hw.topevery.framework.db.enums.ScriptConditionEnum;
import hw.topevery.framework.entity.DbCsp;
import hw.topevery.framework.entity.KeyValue;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 综合评价标准扩展表
 *
 * @author code-generate
 * @date 2022-01-05
 */
@Repository
public class CriterionExpandShowDaoImpl extends BaseDaoImpl<CriterionExpandShow> implements CriterionExpandShowDao {
    @Override
    public <P extends DbCsp> List<CriterionExpandShow> getSearch(P para) {
        return null;
    }

    

    @Override
    public DataPager<CriterionExpandShowVO> listPage(CriterionExpandShowQuery query) {
        String table = "t_criterion_expand_show tces";

        String columns = "tces.*";

        int pageIndex = query.pageIndex - 1;
        int pageSize = query.pageSize;

        SqlQueryMate sqlQueryMate = new SqlQueryMate(table).setColumns(columns).setOrderBy("tces.c_id desc");
        sqlQueryMate
                .where(true, "tces.c_db_status", ScriptConditionEnum.Eq, 0)
        ;

        return getDataPager(sqlQueryMate, pageSize, pageIndex, CriterionExpandShowVO.class);
    }

    @Override
    public CriterionExpandShow getEntityByColumn(String key,String value){
        KeyValue<String> map=new KeyValue<>();
        map.key=key;
        map.value=value;
        return getEntityByColumnEqValue(map);
    }
}
